<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>正泰电力服务后台</title>
    <link rel="stylesheet" href="lay/layui/login/css/style.css"/>
     <link rel="stylesheet" href="layui/css/layui.css"/>
    <!-- 提示升级高级浏览器操作 -->
    <style>
    	.ie-content{  position: fixed; left: 0; top: 0; right: 0; bottom:0; background:#fff; z-index: 1000;}
		.ie-content-bj{ width: 1000px; height: 380px; position: fixed; left: 50%; top: 36%; margin:-190px 0 0 -500px; background:url(img/sj.jpg) no-repeat; }
		.ie-list{ padding:168px 0 0 371px; }
		.ie-list a{ margin-right: 80px; }
    </style>
</head>
<body class="body_bj">

<div class="login" style="height: 250px;">
	<div class="logo">
		正泰电力服务后台
	</div>
	<ul class="login-list">
	    <form class="layui-form" action="">
		<li><input type="text"     name="username"  lay-verify="required|username"  placeholder="请输入用户名"></li>
		<li><input type="password" name="password" lay-verify="required|password"  placeholder="请输入密码"></li>
		<!-- <li><input type="text" placeholder="请输入验证码"><span class="yzm2"><img src="login/img/yzm.jpg" alt=""></span></li> -->
		<li><a class="btn" id="enterSubmit" lay-filter="userLogin" lay-submit="" style="cursor:pointer;">登录</a></li>
		</form>
	</ul>
</div>
<!--[if lt IE 8]>
<div class="ie-content">
	<div class="ie-content-bj">
	    <div class="ie-list">
		    <a href="http://www.google.cn/intl/zh-CN/chrome/browser/"><img src="img/sj1.jpg" alt=""></a>
			<a href="http://www.firefox.com.cn/"><img src="img/sj2.jpg" alt=""></a>
			<a href="http://chrome.360.cn/"><img src="img/sj3.jpg" alt=""></a>	
	    </div>
	</div>
</div>
<![endif]-->


<script type="text/javascript" src="layui/layui.js"></script>
<script>
		layui.use(['jquery','form','layer'], function(){
			var $ = layui.jquery,form = layui.form,layer = layui.layer;

			 //自定义验证规则
		    form.verify({
				username: function(value){
				  if(value==''){
					return '输入用户名';
				  }
				}, 
				password: function(value){
				  if(value==''){
					return '输入密码';
				  }
				}
		    });
		    
		  //监听提交
		  form.on('submit(userLogin)', function(data){
			    //layer.alert(JSON.stringify(data.field), {
			    //  title: '最终的提交信息'
			    //});
			    var url='web/userLogin';        
	            $.ajax({
	                    type : "POST",
	                    url : url,
	                    data : {
	                        s_form_data : JSON.stringify(data.field)
	                    },
	                    dataType : "json",
	                    success : function(data) {
	                            if(data.status==false){
	                            	layer.alert(data.msg, { title: '信息',icon: 5});
							    }else{
							        layer.msg('登录成功,请稍后...', {icon: 1});
							        setTimeout("direct()",1000) ;
							        
							        
							    }
	                    }
	            });
			
			    return false;
		  });
  
		  //回车键触发提交
		    $("input").keydown(function(event) {                
			if(event.keyCode == 13) {                    
				document.getElementById("enterSubmit").click();                
			}            
			
			});
	    
	    });
	    
	    function direct (){
	        location.href="web/direct_home";
	    }

	    
	    
</script>
	
</body>
</html>